import { createRouter, createWebHistory } from 'vue-router'
import SdyHome from '@/views/SdyHome/index.vue'
import sdyCate from '@/views/sdy-cate/index.vue'
import sdyCart from '@/views/sdy-cart/index.vue'
import sdyself from '@/views/sdy-self/index.vue'
import sdyNotfound from '@/views/not-found/index.vue'


const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    // 重定向， 
    {
      path: '/',
      redirect:'/home'
    },
    {
      path: '/home',
      name:'home',
      component: SdyHome
    },
    {
      path: '/cart',
      name:'cart',
      component:sdyCart,
      meta:{ hidFooter : true}
    },
    {
      path: '/cate',
      name:'cate',
      component:sdyCate
    },
    {
      path: '/self',
      name:'self',
      component:sdyself
    },
    {
      path: '/order',
      name:'order',
      component:() =>import('@/views/sdy-order/index.vue'),
      meta:{ hidFooter : true}
    },
    {
      path: '/detail',
      name:'detail',
      component:() =>import('@/views/sdy-detail/index.vue'),
      meta:{ hidFooter : true}
    },
    {
      path: '/login',
      name:'login',
      component:() =>import('@/views/sdy-login/index.vue'),
      meta:{ hidFooter : true}
    },
    {
      path: '/message',
      name:'message',
      component:() =>import('@/views/sdy-self/components/message.vue'),

    },
    {
      path: '/orderaddress',
      name:'orderaddress',
      component:() =>import('@/views/sdy-orderaddress/index.vue'),

    },
    {
      path: '/register',
      name:'register',
      component:() =>import('@/views/sdy-register/index.vue'),
      meta:{ hidFooter : true}
    },
    {
      path: '/list',
      name:'list',
      component:()=>import('@/views/sdyLIst/index.vue')
    },
    {
      path: '/search',
      name:'search',
      component: () => import('@/views/sdy-search/index.vue'),
      meta:{ hidFooter : true}   //写这个目的就是打开的地址没有，我们就不显示底部栏
      
    },
    {
      //找不到路由
      path: '/not-found',
      name:'not-found',
      component: sdyNotfound,
      meta:{ hidFooter : true}   //写这个目的就是打开的地址没有，我们就不显示底部栏
      
    },
    {
      path: '/:pathMath(.*)*',
      redirect:'/not-found'
    }
  ]
})

export default router
